<?php


namespace App\Models\ProductCenter\Models;


use App\Models\ProductCenter\ProductModel;

class SkuInfoModel extends ProductModel
{
    public $table = 'product_sku_info';
    public $fillable = [
        'sku_id',
        'sku',// varchar(64) NOT NULL DEFAULT '' COMMENT 'sku',
        'size_id',// int NOT NULL DEFAULT '0' COMMENT '尺码id',
        'stock',// int NOT NULL DEFAULT '0' COMMENT '库存',
        'price',// decimal(10,2) NOT NULL DEFAULT '0.00',
        'newest_price',// decimal(10,2) NOT NULL DEFAULT '0.00',
    ];
    public $timestamps = false;


    public function size()
    {
        return $this->belongsTo(SizeModel::class, 'size_id', 'id')
            ->selectRaw('id,system_id,label,value')
            ->withDefault([
                'id' => '',
                'system_id' => '',
                'label' => '',
                'value' => ''
            ]);
    }
}
